Report post

What is innerHTML in JavaScript?

gets or sets the HTML or XML markup contained within the element. A string containing the HTML serialization of the element's descendants. Setting the value of innerHTML removes all of the element's descendants and replaces them with nodes constructed by parsing the HTML given in the string htmlString

Should jQuery be sanitized before using innerHTML?

@VLAZ There is a lot that could go wrong with just using innerHTML (), so it's recommended to sanitize the html before using it. Why would this satisfy any security reason? jQuery is a library for JavaScript, so yes, if you consider JavaScript to be insecure, then jQuery is, as well.

How to change inner HTML of element?

There are already answers which give how to change Inner HTML of element. But I would suggest, you should use some animation like Fade Out/ Fade In to change HTML which gives good effect of changed HTML rather instantly changing inner HTML. $ ('#regTitle').fadeOut (500, function () { $ (this).html ('Hello World!').fadeIn (500); });

What is the difference between HTML and jQuery text?

From the jQuery API documentation ( api.jquery.com/text ), text () is different as: Unlike the .html () method, .text () can be used in both XML and HTML documents.. Furthermore, according to stackoverflow.com/questions/1910794/…, jQuery.html () treats the string as HTML, jQuery.text () treats the content as text.

Related articles

The World's Leading Crypto Trading Platform

Get my welcome gifts